package com.lh.java.io;

import java.io.FileInputStream;
import java.io.ObjectInputStream;

public class TestObjectIn {
	public static void main(String args[]) {

		ObjectInputStream ois = null;

		Student s = null;

		try {

			ois = new ObjectInputStream(new FileInputStream("student.txt"));

			System.out.println("--------------------");

			s = (Student) ois.readObject();

			System.out.println(s);

			s.greeting();

			System.out.println("--------------------");

			s = (Student) ois.readObject();

			System.out.println(s);

			s.greeting();

		} catch (Exception e) {

			e.printStackTrace();

		} finally {

			if (ois != null)

				try {

					ois.close();

				} catch (Exception e) {

					e.printStackTrace();

				}
		}
	}
}
